// HealthManager class that takes input from the 
// contacts class, about which objects have collided
// and how hard. It then determines how much damage
// the objects should suffer as a consequence.
#pragma once

#include "Physics//rigidbody.h"
#include <vector>

#define HEALTHMANAGER HealthManager::Instance()

struct GameObjectCollision
{
	physics::RigidBody*		object;
	int						damage;
};


class HealthManager
{
private:
	HealthManager(void);
	HealthManager(const HealthManager&);
	HealthManager* operator=(const HealthManager&);
	~HealthManager(void);

	typedef std::vector<GameObjectCollision*> collisions;

	collisions	mCollisions;

public:
	// used to access this Singleton
	static HealthManager* Instance();

	// checks if the passed object took a hit
	// during the last iteration, and if so, returns how
	// much damage it took
	int GetDamage(physics::RigidBody* object);

	// attempts the rigid body to the list of objects
	// that need to be considered. If it is a worthwhile
	// collision, it will add it to the std::vector
	void AddCollision(physics::RigidBody* object, physics::real force);

	// clears all entries, just so we don't waste memory
	// should be called at the end of the iteration
	void ClearAll(void);
};

